

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  
<!-- Mirrored from webpages.charter.net/edreamleo/slides/scripting-leo/slide-006.html by HTTrack Website Copier/3.x [XR&CO'2010], Fri, 22 Feb 2013 17:58:57 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=UTF-8" /><!-- /Added by HTTrack -->
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Iterators &mdash; Leo v4.8 documentation</title>
    <link rel="stylesheet" href="_static/default.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '4.8',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <script type="text/javascript" src="_static/sidebar.js"></script>
    <link rel="top" title="Leo v4.8 documentation" href="index.html" />
    <link rel="next" title="Using iterators" href="slide-007.html" />
    <link rel="prev" title="p.h and p.b" href="slide-005.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="slide-007.html" title="Using iterators"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="slide-005.html" title="p.h and p.b"
             accesskey="P">previous</a> |</li>
        <li><a href="leo_toc.html">Leo v4.8 documentation</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="iterators">
<h1>Iterators<a class="headerlink" href="#iterators" title="Permalink to this headline">¶</a></h1>
<p>Commanders and positions define <a href="#id1"><span class="problematic" id="id2">`Python
iterators`_</span></a> that return lists of positions in Leo
outlines. These iterators are the easiest way of
gaining access to the nodes of Leo outlines. Here
are few examples (there are many more):</p>
<ul class="simple">
<li><strong>c.all_positions()</strong> returns all the positions
of the outline in order. Cloned nodes will
appear several times in this list.</li>
<li><strong>c.all_unique_nodes()</strong> returns all the vnodes
of the outline.</li>
<li><strong>p.self_and_subtree()</strong> returns p and all its
descendant positions.</li>
<li><strong>p.children()</strong> returns all the positions of
all p&#8217;s direct children.</li>
</ul>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="leo_toc.html">
              <img class="logo" src="_static/Leo4-80-border.jpg" alt="Logo"/>
            </a></p>
  <h4>Previous topic</h4>
  <p class="topless"><a href="slide-005.html"
                        title="previous chapter">p.h and p.b</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="slide-007.html"
                        title="next chapter">Using iterators</a></p>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="slide-007.html" title="Using iterators"
             >next</a> |</li>
        <li class="right" >
          <a href="slide-005.html" title="p.h and p.b"
             >previous</a> |</li>
        <li><a href="leo_toc.html">Leo v4.8 documentation</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2010, Edward K. Ream.
      Last updated on Nov 21, 2010.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.4.
    </div>
  </body>

<!-- Mirrored from webpages.charter.net/edreamleo/slides/scripting-leo/slide-006.html by HTTrack Website Copier/3.x [XR&CO'2010], Fri, 22 Feb 2013 17:58:57 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=UTF-8" /><!-- /Added by HTTrack -->
</html>